/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.chart.ASalesReport;
import com.thor.palmmall.spi.chart.SSalesReport;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class ASalesReportConverter implements Converter<SSalesReport, ASalesReport> {

  public static ASalesReportConverter getInstance() {
    if (instance == null)
      instance = new ASalesReportConverter();
    return instance;
  }

  private static ASalesReportConverter instance;

  private ASalesReportConverter() {
  }

  @Override
  public ASalesReport convert(SSalesReport source) {
    if (source == null) {
      return null;
    }
    ASalesReport target = new ASalesReport();
    target.setDate(source.getDate());
    target.setPassengers(source.getPassengers());
    target.setSales(source.getSales());
    return target;
  }

}
